﻿@{
    Layout = null;
}
@using FwProject.Distribution.Dto
@using FwProject.ManagerConfig.Dto
@model List<MakingReceiptOutputDto>
@{
    ConfigInfoDto config = ViewBag.Config;
}
<html>
<head>
    <title>打印</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link href="/css/print.css" rel="stylesheet" />
    <style>
        .gzImg {
            filter: alpha(opacity=80);
            -moz-opacity: 0.8;
            width: auto !important;
            width: 100%
        }

        INPUT, button {
            height: 20px;
            border: 1px #ccc outset;
            margin-top: 5px;
            margin-left: 5px;
        }

        INPUT {
            background-color: #E43D3D;
            color: #fff;
            height: 25px;
            padding: 5px 5px;
        }
    </style>
    <script src="~/Scripts/jquery-3.1.1.min.js"></script>
    <script>
        var getFontSize = function (obj) {
            var fs = obj.css("fontSize");
            if (fs != null) {
                return parseFloat(fs, 10);
            } else {
                return getFontSize(obj.parent());
            }
        };
        $(function () {
            function zoomFont(m) {
                $("td").each(function (i) {
                    var f = getFontSize($(this));
                    $(this).css("fontSize", (f + m) + "px");
                });
                if (m >= 0) {
                    var label = $("#zoomBig label");
                    label.text(parseInt(label.text(), 10) + m);
                } else {
                    var label = $("#zoomSmall label");
                    label.text(parseInt(label.text(), 10) - m);
                }
            }
            $("#zoomBig").click(function () {
                zoomFont(1);
            });
            $("#zoomSmall").click(function () {
                zoomFont(-1);
            });
            $("#zoomInit").click(function () {
                $("td").each(function (i) {
                    var f = $(this).attr("initf");
                    $(this).css("fontSize", f + "px");
                });
                $("button label").text(0);
            });

            $("td").each(function (i) {
                var f = getFontSize($(this));
                $(this).attr("initf", f);
            });
        });


    </script>
</head>
<body style="margin:0px 0px;padding:0px 0px;">
    @*<button id="zoomBig" class="noprint">放大<label>0</label></button>
    <button id="zoomSmall"class="noprint">缩小<label>0</label></button>
    <button id="zoomInit" class="noprint">还原</button>*@
    <OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0 style="display: none"></OBJECT>
    <div align="center"><input type=button class="noprint" value="打印" onClick="window.print()"> <input type=button class="noprint" value="打印预览" onclick="document.all.WebBrowser.ExecWB(7,1)"></div>
    <form name="printformName" id="printformName" action="" method="post">
        <div align="center">
            <div id="printObj" style="width: 190mm" align="center">
                <style>
                    table {
                        border-collapse: collapse;
                        border-spacing: 0px;
                    }
                </style>

                @foreach (var item in Model)
                {
                    var month = item.DeliveryDate.Split('-')[1];
                    <table name="mainTable" style="width:100%;height:auto;text-align: center;margin-bottom:0px;margin-top:10px;" border="0">
                        <tr>
                            <td align='center' style='width:100%;'>
                                <table cellSpacing=0 cellPadding=0 style="width: 600px">
                                    <tr>
                                        <td align="center" width="100%" style="font-size: 22px;color:#000000;padding-top: 0px;" colspan="2">
                                            @config?.CorporateName
                                        </td>
                                        <td rowspan="5" align="right" valign="bottom">
                                            <div style="color:#000000;font-size:12px;line-height:12px;width:5px;margin-right:-10px;">
                                                一联存根<br /><br />二联客户<br /><br />三联记账
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td nowrap="nowrap" align="left" nowrap width=50% style="font-size: 14px;color:#000000;">
                                            地址：@config?.CorporateAddress
                                        </td>
                                        <td nowrap="nowrap" align="right" width="50%" style="font-size: 14px;color:#000000;padding-right:150px">
                                            电话：@config?.CorporateMobile
                                        </td>
                                        <td style="position:relative;"></td>
                                    </tr>
                                    <tr>
                                        <td align="center" width="100%" style="font-size: 22px;color:#000000;" colspan="3" replace_header_5681>
                                            收&nbsp;&nbsp;款&nbsp;&nbsp;收&nbsp;&nbsp;据
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" colspan="3">
                                            @DateTime.Now.ToString("yyyy-MM-dd") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;<span id='number'>@item.CreationNumber</span>
                                        </td>

                                    </tr>
                                    <tr>
                                        <td align="left" colspan="3" valign="top">
                                            <table name="justForJeDis" align='left' width='100%' cellSpacing=0 cellPadding=0 style='border:1px solid #000000;'>
                                                <tr>
                                                    <td align="center" style='color: #000000;font-size: 16px;width: 100px;'>今&nbsp;&nbsp;收&nbsp;&nbsp;到</td>
                                                    <td align='left' style='width:500px;border-bottom: 1px solid #000000;font-size: 16px;padding:5px 0px' replace_wldwName_5681>
                                                        @item.RestaurantName&nbsp;@(month)月份餐具（@(item.DeliveryDate)）
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="center" style="color: #000000;font-size: 16px;">配&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送</td>
                                                    <td width=500px>
                                                        <table align='left' width='100%' cellSpacing=0 cellPadding=0>
                                                            @foreach (var i in item.Suits)
                                                            {
                                                                <tr>
                                                                    <td nowrap width="100%" align='left' style='border-bottom: 1px solid #000000;font-size: 16px;padding:5px 0px'>
                                                                        @i.Name ：

                                                                        @i.Quantity
                                                                        箱

                                                                        =&nbsp; <span name='slQuaPs'></span>
                                                                        @i.Count
                                                                        套

                                                                        x&nbsp;@i.Price
                                                                        =&nbsp;<span name='jeMoney'>@i.Total</span>元
                                                                    </td>
                                                                </tr>
                                                            }
                                                        </table>
                                                    </td>
                                                </tr>

                                                <tr><td align='center' style='color: #000000;font-size: 16px;width: 100px;'>优&nbsp;惠&nbsp;金&nbsp;额</td><td align='left' style='border-bottom: 1px solid #000000;font-size: 16px;padding:5px 0px' colspan='2'>@item.DiscountedPrice &nbsp;元</td></tr>
                                                <tr>
                                                    <td align="center" style="font-size: 16px;">
                                                        <div align="center" style='color: #000000;width: auto;'>
                                                            <div>金&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;额</div>
                                                            <div>人&nbsp;&nbsp;民&nbsp;&nbsp;币</div>
                                                        </div>
                                                    </td>
                                                    <td style='border-bottom: 1px solid #000000' nowrap="nowrap">
                                                        <table width='100%' cellSpacing=0 cellPadding=0>
                                                            <tr>
                                                                <td align='left' style='color: #000000;font-size: 16px;width: 60px;'>(大写)</td>
                                                                <td align="left" style='font-size: 16px;padding:5px 0px'>
                                                                    <span name='jeAccountUpper'> @item.Capital </span>&nbsp;&nbsp;&nbsp;
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="center" style='color: #000000;font-size: 16px;width: 100px;'>
                                                        备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注
                                                    </td>
                                                    <td style="padding:5px 0px">
                                                        <table width='100%' cellSpacing=0 cellPadding=0>
                                                            <tr>
                                                                <td style='font-size: 16px;' align='left'><div style="white-space: normal;">@item.RemarksConten</div></td>
                                                                <td width='30%' nowrap style='border-left: 1px solid #000000;font-size: 16px;'>
                                                                    &nbsp;￥
                                                                    <span width='100px' name='jeAccount'>@item.Sum</span>元
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>

                            </td>
                        </tr>
                        <tr>
                            <td align='center' style='width:100%;'>
                                <table cellSpacing=0 cellPadding=0 style="width: 600px">
                                    <tr align="left" width="100%">
                                        <td nowrap="nowrap" style="font-size: 16px;color:#000000;padding-right:50px;width:25%">
                                            单位盖章：

                                        </td>
                                        <td nowrap="nowrap" style="font-size: 16px;color:#000000;padding-right:10px;width:25%">会计：@(config?.Accountant)</td>
                                        <td nowrap="nowrap" style="font-size: 16px;color:#000000;padding-right:10px;width:25%">出纳：@(config?.Cashier)</td>
                                        <td nowrap="nowrap" align="right" style="font-size: 16px;color:#000000;width:25%" replace_jbr_5681>经手人：@(config?.AgentPerson)</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                }
                <!--
                -->
            </div>
        </div>
    </form>
    <script>
        var orgid = "1913";
        if (window["replace_" + orgid] != null) {
            window["replace_" + orgid]();
        }
        //使用方式，在需要替换的节点增加replace_xxx_orgid属性。并添加对应的替换方法replace_orgid。
        /**
         * 当且仅针对广西全心宜对收据部分描述修改
         */
        function replace_5681() {
            $("td[replace_header_5681]").html("收&nbsp;&nbsp;款&nbsp;&nbsp;凭&nbsp;&nbsp;据");
            $("td[replace_wldwName_5681]").each(function () {
                var v1 = $(this).text();
                v1 = v1.replace("月份餐具", "月份餐具消毒服务费");
                $(this).text(v1);
            });
            $("td[replace_jbr_5681]").each(function () {
                var v1 = $(this).text();
                v1 = v1.replace("经手人", "收款人");
                $(this).text(v1);
            });
        }
    </script>
</body>
</html>